cmake_minimum_required(VERSION 2.8)

project(Hunter)
message(STATUS "Project name : --- ${PROJECT_NAME}")

message(STATUS "Current dir : --- ${CMAKE_CURRENT_SOURCE_DIR}")

set(CMAKE_BUILD_TYPE Release)

#-----------------------------------------------------------------------------
# 配置平台参数
#

if (NOT CROSS_PLATFORM)
	set(CROSS_PLATFORM RV1126)
endif ()

if (NOT UVC)
	set(UVC NO)
endif ()
message(STATUS "CROSS_PLATFORM : --- ${CROSS_PLATFORM}")

#-----------------------------------------------------------------------------

if (EXISTS ${PROJECT_SOURCE_DIR}/build/Rules/allRules.cmake)
	include(${PROJECT_SOURCE_DIR}/build/Rules/allRules.cmake)
else ()
	message(FATAL_ERROR "Can't include allRules.cmake")
endif ()

# add_compile_options(-std=c++17 -lstdc++fs)

set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
message(STATUS "LIBRARY_OUTPUT_PATH : ${LIBRARY_OUTPUT_PATH}")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLOG_MODULE_NAME='\"libHunter\"' -fpermissive")
message(STATUS "CXXFLAGS : ${CMAKE_CXX_FLAGS}")

if (${UVC} STREQUAL YES)
	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUVC")
endif()


# add_subdirectory(app)
aux_source_directory(. dir_source)
aux_source_directory(./app dir_source1)
aux_source_directory(./src dir_source2)
aux_source_directory(./src/hidDeviceManager dir_source3)
aux_source_directory(./src/hidDeviceManager/dfu dir_source4)
aux_source_directory(./src/hidDeviceManager/dfu/crc dir_source5)

include_directories(./include)
include_directories(./depModules)
include_directories(./depModules/Foundation)
include_directories(./include/jsoncpp)
include_directories(./include/frame_common)
include_directories(./depModules/MagicBox)
include_directories(./depModules/NearHubRoomsMedia)
include_directories(./depModules/Protocol)
include_directories(./depModules/Stream)
include_directories(./include/sqlite3)
include_directories(./include/Pal)
include_directories(./include/ini)
include_directories(./include/sys)
include_directories(./app)
include_directories(./src)
include_directories(./src/hidDeviceManager/dfu)
include_directories(./src/hidDeviceManager/dfu/crc)
include_directories(./src/hidDeviceManager/)

add_library(Hunter STATIC ${dir_source} ${dir_source1} ${dir_source2}
	 ${dir_source3} ${dir_source4} ${dir_source5})
